#!/bin/bash -e

ROOT=$(realpath $(dirname $0)/..)
cd $ROOT

# Sanity checks to make sure we're in a proper directory before we go nuke-happy.
test -d daq
test -d misc

sudo rm -rf inst build
sudo rm -f .build_hash

docker ps -aq --no-trunc | xargs -r docker rm -f || true

docker images | egrep ^daqf/ | awk '{print $1":"$2}' | xargs -r docker rmi || true


docker images -q --filter dangling=true | xargs -r docker rmi || true

docker system prune -f
